package com.chey.service.impl;

import com.chey.dao.ShowDao;
import com.chey.domain.Pages;
import com.chey.domain.QueryData;
import com.chey.domain.Show;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;


/**
 * @author JanYao
 * @version 0.1
 */
@Service
public class ShowServiceImpl implements com.chey.service.ShowService{
    @Autowired
    private ShowDao showDao;

    @Override
    public Pages findSome(Pages pages, QueryData queryData) {
        queryData.setId("%"+queryData.getId()+"%");
        List<Show> data = showDao.findSome(pages, queryData);
        Pages<Show> objectPages = new Pages<>();
            if ("1".equals(queryData.getStatus())) {
                objectPages.setTotal(showDao.ConditionCounts(queryData).intValue());
            } else {
                Long counts = showDao.counts();
                objectPages.setTotal(counts.intValue());
            }






        objectPages.setData(data);
        return objectPages;
    }
}
